<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<lv-form class="formGroup">
    <ng-container *ngFor='let item of info'>
        <lv-form-item>
            <div class="aui-gutter-column-lg">
                <h2>{{item.header}}</h2>
            </div>
        </lv-form-item>
        <ng-container *ngFor='let child of item.children'>
            <lv-form-item>
                <lv-form-label>
                    {{child.label}}
                </lv-form-label>
                <lv-form-control>
                    <ng-container [ngSwitch]='child.key'>
                        <ng-container *ngSwitchCase='"copyDataSelectionPolicy"'>
                            {{child.value | textMap: 'CopyData_Selection_Policy'}}
                        </ng-container>
                        <ng-container *ngSwitchCase='"scheduleInterval"'>
                            <ng-container [ngSwitch]="componentData.selectionPolicy.schedulePolicy">
                                <ng-container *ngSwitchCase="schedulePolicy.AfterBackupDone">
                                    {{'explore_after_backup_done_label'|i18n}}
                                </ng-container>
                                <ng-container *ngSwitchCase="schedulePolicy.PeriodSchedule">
                                    {{child.value}}
                                </ng-container>
                                <ng-container *ngSwitchDefault>
                                    --
                                </ng-container>
                            </ng-container>
                        </ng-container>
                        <ng-container *ngSwitchCase='"retentionValue"'>
                            <ng-container [ngSwitch]="componentData.selectionPolicy.retentionPolicy">
                                <ng-container *ngSwitchCase="retentionPolicy.Permanent">
                                    {{'explore_permanent_retention_label'|i18n}}
                                </ng-container>
                                <ng-container *ngSwitchCase="retentionPolicy.LatestOne">
                                    {{'explore_always_latest_label'|i18n}}
                                </ng-container>
                                <ng-container *ngSwitchCase="retentionPolicy.FixedTime">
                                    {{'common_retention_label'|i18n}}{{spaceLabel}}{{child.value}}{{spaceLabel}}
                                    {{componentData.selectionPolicy.retentionUnit |textMap:'Interval_Unit'}}
                                </ng-container>
                                <ng-container *ngSwitchDefault>
                                    --
                                </ng-container>
                            </ng-container>
                        </ng-container>
                        <ng-container *ngSwitchCase="'bindWidth'">
                            <lv-group lvDirection='vertical' lvGutter='8px'
                                *ngIf="componentData.selectionMount.bindWidthStatus">
                                <lv-group *ngIf="componentData.selectionMount.min_bandwidth">
                                    {{'explore_min_label' | i18n: []: true}}
                                    {{componentData.selectionMount.min_bandwidth}}
                                </lv-group>
                                <lv-group *ngIf="componentData.selectionMount.max_bandwidth">
                                    {{'explore_max_label' | i18n: []: true}}
                                    {{componentData.selectionMount.max_bandwidth}}
                                </lv-group>
                                <lv-group *ngIf="componentData.selectionMount.burst_bandwidth">
                                    {{'explore_burst_label' | i18n: []: true}}
                                    {{componentData.selectionMount.burst_bandwidth}}
                                </lv-group>
                            </lv-group>
                            <ng-container *ngIf="!componentData.selectionMount.bindWidthStatus">
                                {{'common_disable_label' | i18n}}
                            </ng-container>
                        </ng-container>
                        <ng-container *ngSwitchCase="'iops'">
                            <lv-group lvDirection='vertical' lvGutter='8px'
                                *ngIf="componentData.selectionMount.iopsStatus">
                                <lv-group *ngIf="componentData.selectionMount.min_iops">
                                    {{'explore_min_label' | i18n: []: true}}
                                    {{componentData.selectionMount.min_iops}}
                                </lv-group>
                                <lv-group *ngIf="componentData.selectionMount.max_iops">
                                    {{'explore_max_label' | i18n: []: true}}
                                    {{componentData.selectionMount.max_iops}}
                                </lv-group>
                                <lv-group *ngIf="componentData.selectionMount.burst_iops">
                                    {{'explore_burst_label' | i18n: []: true}}
                                    {{componentData.selectionMount.burst_iops}}
                                </lv-group>
                            </lv-group>
                            <ng-container *ngIf="!componentData.selectionMount.iopsStatus">
                                {{'common_disable_label' | i18n}}
                            </ng-container>
                        </ng-container>
                        <ng-container *ngSwitchCase="'latency'">
                            <lv-group *ngIf="componentData.selectionMount.latencyStatus">
                                {{'explore_max_label' | i18n: []: true}}
                                {{child.value | nil}}
                            </lv-group>
                            <ng-container *ngIf="!componentData.selectionMount.latencyStatus">
                                {{'common_disable_label' | i18n}}
                            </ng-container>
                        </ng-container>
                        <ng-container *ngSwitchCase="'target_location'">
                            {{ child.value | textMap: 'Target_Location'}}
                        </ng-container>
                        <ng-container *ngSwitchCase="'networkLocation'">
                            <lv-datatable lvSize="small" [lvData]="componentData.selectionMount.networkTableData"
                                #networkTable>
                                <thead>
                                    <tr>
                                        <th>{{'common_network_adapter_label' | i18n}}</th>
                                        <th>{{'common_network_name_label' | i18n}}</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr *ngFor='let item of networkTable.renderData'>
                                        <td>
                                            <span lv-overflow>
                                                {{item.name}}
                                            </span>
                                        </td>
                                        <td>
                                            <span lv-overflow>
                                                {{item.selectionName}}
                                            </span>
                                        </td>
                                    </tr>
                                </tbody>
                            </lv-datatable>
                        </ng-container>
                        <ng-container *ngSwitchCase="'targetCPU'">
                            <ng-container [ngSwitch]="componentData.selectionMount.targetCPU">
                                <ng-container *ngSwitchCase="targetCPU.OriginalConfig">
                                    {{'common_original_configuration_label' | i18n}}
                                </ng-container>
                                <ng-container *ngSwitchCase="targetCPU.SpecifyConfig">
                                    <lv-form-item>
                                        <lv-form-label></lv-form-label>
                                        <lv-form-control>
                                            <lv-group>
                                                <lv-form-label>{{'explore_virtual_sockets_label' | i18n}}
                                                </lv-form-label>
                                                <lv-form-control>
                                                    {{componentData.selectionMount.num_virtual_sockets}}
                                                </lv-form-control>
                                            </lv-group>
                                        </lv-form-control>
                                    </lv-form-item>
                                    <lv-form-item>
                                        <lv-form-label></lv-form-label>
                                        <lv-form-control>
                                            <lv-group>
                                                <lv-form-label>{{'explore_cores_per_virtual_label' | i18n}}
                                                </lv-form-label>
                                                <lv-form-control>
                                                    {{componentData.selectionMount.num_cores_per_virtual}}
                                                </lv-form-control>
                                            </lv-group>
                                        </lv-form-control>
                                    </lv-form-item>
                                </ng-container>
                                <ng-container *ngSwitchDefault>
                                    --
                                </ng-container>
                            </ng-container>
                        </ng-container>
                        <ng-container *ngSwitchCase="'targetMemory'">
                            <ng-container [ngSwitch]="componentData.selectionMount.targetMemory">
                                <ng-container *ngSwitchCase="targetMemory.OriginalConfig">
                                    {{'common_original_configuration_label' | i18n}}
                                </ng-container>
                                <ng-container *ngSwitchCase="targetMemory.SpecifyConfig">
                                    <lv-form-item>
                                        <lv-form-label></lv-form-label>
                                        <lv-form-control>
                                            <lv-group>
                                                <lv-form-label>{{'common_size_label'|i18n}} (MB) </lv-form-label>
                                                <lv-form-control>
                                                    {{componentData.selectionMount.memory_size}}
                                                </lv-form-control>
                                            </lv-group>
                                        </lv-form-control>
                                    </lv-form-item>
                                </ng-container>
                                <ng-container *ngSwitchDefault>
                                    --
                                </ng-container>
                            </ng-container>
                        </ng-container>
                        <ng-container *ngSwitchDefault>
                            <div style="width: 450px;" lv-overflow>
                                {{child.value | nil}}
                            </div>
                        </ng-container>
                    </ng-container>
                </lv-form-control>
            </lv-form-item>
        </ng-container>
    </ng-container>
</lv-form>
